const express = require('express')

const router = express.Router()

const artcateHandler = require('../router_handler/artcate')

// 导入验证数据的中间件
const expressJoi = require('@escook/express-joi')
const { add_cate_schema, delete_cate_schema, get_cate_schema, update_cate_schema } = require('../schema/artcate')

router.get('/cates', artcateHandler.getArticleCates)
router.post('/addcate', expressJoi(add_cate_schema), artcateHandler.addArticleCates)
router.get('/deletecate/:id', expressJoi(delete_cate_schema), artcateHandler.deleteCateById)
router.get('/cates/:id', expressJoi(get_cate_schema), artcateHandler.getArtCateById)
router.post('/upatecate', expressJoi(update_cate_schema), artcateHandler.updateCate)

module.exports = router